package com.panda.mall.common.mallUser.enums;

import com.panda.mall.common.base.EnumInterface;
import lombok.Getter;

/**
 * author: tcy
 * description:性别枚举
 */
public enum GenderEnum implements EnumInterface {

    WOMAN("woman",0,"女"),
    MAN("man",1,"男");

    /**
     * 编码
     */
    @Getter
    protected String code;

    /**
     * 值
     */
    @Getter
    protected Integer value;


    /**
     * 键
     */
    @Getter
    protected String key;

    GenderEnum(String code, int value, String key) {
        this.code = code;
        this.value = value;
        this.key = key;
    }

    public static GenderEnum getByValue(Integer value) {

        GenderEnum baseEnum = null;

        for (GenderEnum item : values()) {
            if (item.getValue().equals(value)) {
                baseEnum = item;
                continue;
            }
        }
        return baseEnum;
    }

}
